<?php

namespace Modules\Admin\Http\Requests;

use Illuminate\Contracts\Validation\Validator;
use Illuminate\Foundation\Http\FormRequest;

class TestRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'name' => 'required|max:8',
            'email'=>'required'
        ];
    }

    public function messages(){
        return [
            'title.required'=>'标题不能为空',
            'body.required'=>'内容不能为空',
            'title.max'=>'标题最大不能超过4个字符',
        ];
    }

//    protected function failedValidation(Validator $validator)
//    {
//        dd($validator->errors()->messages());
//    }
}
